/*
数据结构 解题报告：
http://git.oschina.net/et0662/sznoi-Data_Structure
*/
#include<stdio.h>

typedef struct _NODE{
	int data;
	struct _NODE * before;
	struct _NODE * next;
}Node, *Link;

int main(void)
{
	Node *head,*tail,*p, *temp;
	Link link;

	int n,m1,m2;

	int i;

	int dir;
	
	head=new Node;
	head->before=NULL;
	head->next=NULL;
	tail=NULL;

	scanf("%d%d%d",&n,&m1,&m2);

	/* 初始化圈圈 */
	for(i=1;i<=n;i++)
	{
		p=new Node;
		p->data=i;
		if(tail)
		{
			p->before=tail;
			tail->next=p;
		}
		else
		{
			p->before=NULL;
		}
		p->next=NULL;
		tail=p;
		if(! head->next)
			head->next=p;
	}
	tail->next=head->next;
	head->next->before=tail;

	i=0;
	p=head;
	dir=1;

	while(p->next->next!=p->next)
	{
		if(dir)
		{
			i++;
			if(i==m1)
			{
				dir=0;
				i=1;
				temp=p->next;
				p->next=temp->next;
				temp->next->before=temp->before;
				delete(temp);
				continue;
			}
			p=p->next;
		}
		else
		{
			i++;
			if(i==m2)
			{
				dir=1;
				i=1;
				temp=p->before;
				p->before=temp->before;
				temp->before->next=temp->next;
				delete(temp);
				continue;
			}
			p=p->before;
		}
	}
	printf("%d\n",p->next->data);	
	temp=p->next;
	delete(temp);
	delete(head);
	return 0;
}
